<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>cocos.sprite</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body>
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar">
  <tr valign="middle">
  <!-- Project homepage -->
      <!--<th class="navbar" 
            ><a class="navbar" target="_top" href="http://www.cocos2d.org/">cocos2d API reference</a></th>-->

  <!-- Tree link -->
      <th><a
        href="module-tree.html">Trees</a></th>

  <!-- Index link -->
      <th><a
        href="identifier-index.html">Indices</a></th>

  <!-- Breadcrumbs -->
      <th class="navbar-breadcrumbs">
        <span class="breadcrumbs">
          <a href="cocos-module.html">cocos</a>&nbsp;.&nbsp;sprite
        </span>
      </th>

      <th class="navbar last">
        <a href="javascript:toggleFrames()">Toggle&nbsp;frames</a>
      </th>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module cocos.sprite</h1>
<p>Sprites allows to display a image in a rectangular area, which can be rotated,
scaled and moved.
The placement in the scene follows the standard CocosNode rules.
Also, all stock actions will work with sprites.</p>
<div class="rst-section" id="rst-animating-a-sprite">
<h1 class="heading">Animating a sprite</h1>
<p>Animation as in cartoon style animation, that is, replacing the image fast
enough to give the illusion of movement, can be accomplished by:</p>
<blockquote>
<ul class="rst-simple">
<li>using an animated .gif file as source for the image</li>
<li>passing a pyglet.image.Animation as image, which collects a number of images</li>
<li>have an array of images and let your code assign to the sprite image member</li>
</ul>
</blockquote>
</div>
<div class="rst-section" id="rst-changing-a-sprite-by-way-of-actions">
<h1 class="heading">Changing a sprite by way of actions</h1>
<p>To execute any action you need to create an action:</p>
<pre class="py-doctest">
move = MoveBy( (50,0), 5 )</pre>
<p>In this case, <tt class="rst-docutils literal"><span class="pre">move</span></tt> is an action that will move the sprite
50 pixels to the right (<tt class="rst-docutils literal"><span class="pre">x</span></tt> coordinate) and  0 pixel in the <tt class="rst-docutils literal"><span class="pre">y</span></tt> coordinate
in 5 seconds.</p>
<p>And now tell the sprite to execute it:</p>
<pre class="py-doctest">
sprite.do( move )</pre>
</div>

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
        <h2>Classes</h2>
<table class="summary">
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="cocos.sprite.Sprite-class.html" class="summary-name">Sprite</a>
<div class="summary-description">A CocosNode that displays a rectangular image.</div>
    </td>
  </tr>
</table>
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar">
  <tr valign="middle">
  <!-- Project homepage -->
      <!--<th class="navbar" 
            ><a class="navbar" target="_top" href="http://www.cocos2d.org/">cocos2d API reference</a></th>-->

  <!-- Tree link -->
      <th><a
        href="module-tree.html">Trees</a></th>

  <!-- Index link -->
      <th><a
        href="identifier-index.html">Indices</a></th>

  <!-- Breadcrumbs -->
      <th class="navbar-breadcrumbs">
        <span class="breadcrumbs">
          <a href="cocos-module.html">cocos</a>&nbsp;.&nbsp;sprite
        </span>
      </th>

      <th class="navbar last">
        <a href="javascript:toggleFrames()">Toggle&nbsp;frames</a>
      </th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Wed Oct 26 10:00:12 2011
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
